import 'package:flutter/material.dart';
import 'package:yp/config/style.dart';
import 'package:yp/widgets/index.dart';

/// 我的奖品
class MyPrizeList extends StatefulWidget {
  const MyPrizeList({Key key}) : super(key: key);

  @override
  _MyPrizeListState createState() => _MyPrizeListState();
}

class _MyPrizeListState extends State<MyPrizeList>
    with SingleTickerProviderStateMixin {
  AnimationController _controller;

  @override
  void initState() {
    super.initState();
    _controller = AnimationController(vsync: this);
  }

  @override
  void dispose() {
    super.dispose();
    _controller.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return ListView.separated(
        shrinkWrap: true,
        padding: EdgeInsets.zero,
        itemBuilder: (context, index) => _item(index),
        separatorBuilder: (context, index) => Padding(
              padding: const EdgeInsets.only(left: 12),
              child: YpLine(),
            ),
        itemCount: 10);
  }

  Widget _item(int index) {
    return Padding(
      padding: const EdgeInsets.only(top: 20, bottom: 12),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          Row(
            children: [
              Expanded(
                child: Row(
                  children: [
                    SizedBox(width: 12),
                    Container(
                      width: 4,
                      height: 14,
                      color: Color(0xff9f041b),
                    ),
                    SizedBox(width: 6),
                    Text('奖品名称',
                        style: TextStyle(
                            color: EsColors.Title,
                            fontSize: EsSizes.MD,
                            fontWeight: EsFontWeights.Medium))
                  ],
                ),
              ),
              Text('未核销',
                  style: TextStyle(
                      color: EsColors.Money,
                      fontSize: EsSizes.SM,
                      fontWeight: EsFontWeights.Normal)),
              SizedBox(width: 14)
            ],
          ),
          Padding(
            padding: const EdgeInsets.only(top: 12, bottom: 5),
            child: Row(
              children: [
                SizedBox(width: 20),
                Expanded(
                  child: Text('价值1000元礼品',
                      style: TextStyle(
                          color: EsColors.TitleSecondary,
                          fontSize: EsSizes.MD,
                          fontWeight: EsFontWeights.Normal)),
                ),
                Icon(Icons.arrow_forward_ios,
                    size: EsSizes.XS, color: EsColors.Fill),
                SizedBox(width: 14)
              ],
            ),
          ),
          Padding(
            padding: const EdgeInsets.only(left: 20),
            child: Text('张三',
                style: TextStyle(
                    color: EsColors.ContentSecondary,
                    fontSize: EsSizes.XS,
                    fontWeight: EsFontWeights.Normal)),
          ),
        ],
      ),
    );
  }
}
